package com.example.demo.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.demo.mapper.CityMapper;
import com.example.demo.model.City;

@Controller
@ResponseBody
@RequestMapping("/world")
public class CityController {
	
	@Autowired(required = false)
	private CityMapper cityMapper;
	
	
	@GetMapping("/getCity")
	public City getCity(Integer id)
	{
		return cityMapper.getCityById(id);
	}
	
	@GetMapping("/getAllCity")
	public List<City> getAllCitys()
	{
		return cityMapper.getAllCity();
	}
	
	  @GetMapping("/test")
	    public List<String> getCases() {
	        // and convert it to a list of WorkflowCase objects
	       List<String> ll = new ArrayList<String>();
	       ll.add("Helloword");
	        return ll;
	    }
}
